<template>
    <div>
        <div v-title>百分保</div>
        <van-swipe :autoplay="3000">
            <van-swipe-item v-for="(item, index) in images" :key="index">
                <img :src="item.src" style="width: 100%" @click="jump(item.ID)" />
            </van-swipe-item>
        </van-swipe>
        <van-row class="content">
            <van-col span="12">
                <div class="every" @click="gotoone">
                    <div class="lefter">
                        <div class="circle">
                            <span class="iconfont icon-chexianbaojia confonter"></span>
                        </div>
                    </div>
                    <div class="righter">
                        <p class="onep">保费分期</p>
                        <p class="twop">在线、及时、透明</p>
                    </div>
                </div>
                <div class="every" @click="gototwo">
                    <div class="lefter">
                        <div class="circle" style="background: #13d578">
                            <span class="iconfont icon-unie607 confonter"></span>
                        </div>
                    </div>
                    <div class="righter">
                        <p class="onep">办理理赔</p>
                        <p class="twop">放心、省心、贴心</p>
                    </div>
                </div>
            </van-col>
            <van-col span="12">
                <div class="every" @click="gototwo">
                    <div class="lefter">
                        <div class="circle" style="background: #f19149">
                            <span class="iconfont icon--guzhangweixiu confonter"></span>
                        </div>
                    </div>
                    <div class="righter">
                        <p class="onep">维修保养</p>
                        <p class="twop">便捷又省钱</p>
                    </div>
                </div>
                <div class="every" @click="gototwo">
                    <div class="lefter">
                        <div class="circle" style="background:#f03745">
                            <span class="iconfont icon-jifenshangcheng confonter"></span>
                        </div>
                    </div>
                    <div class="righter">
                        <p class="onep">积分商城</p>
                        <p class="twop">优惠天天享</p>
                    </div>
                </div>
            </van-col>
        </van-row>
        <div class="indeximg"><img src="../image/indeximg.png" alt="" @click="jumpagent"></div>
        <div class="baoxian">
            <div class="title">
                <span class="leftbor"></span>合作保险公司</div>
            <van-row class="per">
                <van-col span="8" v-for="(item,index) in List" :key="index" @click.native="GoTwoer(item.ID,item.IsEnable)">
                    <div class="imger"><img :src="item.Logo" /></div>
                    <p>{{item.Name}}</p>
                </van-col>
            </van-row>
        </div>
        <p class="toword" style="margin-top:30px">客服热线：400-170-1235</p>
        <p class="toword" style="padding-bottom: 80px;">浙ICP备18008342号-1</p>
    </div>
</template>
<style src="../css/iconfont.css"></style>
<script>
import api from '../fetch/api.js';
import { Swipe, SwipeItem, Row, Col, Tabbar, TabbarItem, Toast } from 'vant';
export default {
    components: {
        [Swipe.name]: Swipe,
        [SwipeItem.name]: SwipeItem,
        [Row.name]: Row,
        [Col.name]: Col,
        [Tabbar.name]: Tabbar,
        [TabbarItem.name]: TabbarItem,
        [Toast.name]: Toast
    },
    data() {
        return {
            images: [],
            List: [],
            IsCertification:'',
        }
    },
    created() {
        this.GetModel()
        api.GetBanner().then(res => {
            for (let i = 0; i < res.rows.length; i++) {
                this.images.push({
                    src: res.rows[i].Picture,
                    ID: res.rows[i].ID
                })
            }
        })
        api.GetInsuranceList().then(res => {
            for (let i = 0; i < res.length; i++) {
                this.List.push({
                    Name: res[i].Name,
                    Logo: res[i].Logo,
                    ID:res[i].ID,
                    IsEnable:res[i].IsEnable,
                })
            }
        })
    },
    methods: {
        gotoone() {
            this.$router.push('/InsuName/1')
        },
        gototwo() {
            Toast('敬请期待')
        },
        GoTwoer(p,i) {
            if(i==1){
                Toast('因业务调整，该保险公司业务暂时下架，请选择其他保险公司')
                return
            }
            this.$router.push('/InsuName/' + p)
        },
        jump(id) {
            this.$router.push('/BannerDetails/' + id)
        },
        GetModel() {
            api.GetModel().then(res => {
                this.IsCertification = res.IsCertification;
            });
        },
        jumpagent() {
            if(this.IsCertification==1){
                this.$router.push('/IAmAgent')
            }else{
                this.$router.push('/Agent')
            }
        },
        
    }
}
</script>
<style scoped>
p {
    margin: 0
}

.content {
    background: #fff
}

.confonter {
    font-size: 20px
}

.circle {
    width: 45px;
    line-height: 45px;
    border-radius: 50%;
    background: #139fed;
    text-align: center;
    color: #fff;
    float: left;
    margin-left: 20%;
}

.every {
    padding: 20px 0;
    overflow: hidden;
    border-bottom: 1px solid #f5f5f9;
    border-left: 1px solid #f5f5f9;
}

.onep {
    font-size: 14px;
    color: #333333;
    padding-left: 10px;
}

.twop {
    font-size: 12px;
    color: #999999;
    padding-left: 10px;
}

.lefter {
    overflow: hidden;
    width: 35%;
    float: left;
}

.righter {
    width: 65%;
    float: left;
    padding: 5px 0
}

@media screen and (max-width: 374px) {
    .circle {
        width: 40px;
        line-height: 40px;
        margin-left: 15%;
    }
    .righter {
        padding: 0
    }
    .onep {
        padding: 0
    }
    .twop {
        padding: 0
    }
}

.baoxian {
    background: #fff;
    padding: 0 10px;
    margin-top: 10px
}

.title {
    padding: 10px 0;
    font-size: 14px;
}

.leftbor {
    width: 4px;
    height: 17px;
    background: #2491ff;
    display: block;
    float: left;
    margin: 3px 10px 0 0;
    border-radius: 5px;
}

.imger {
    width: 60%;
    margin: auto
}

.imger img {
    width: 100%;
}

.per p {
    text-align: center;
    font-size: 12px;
    padding: 3px 0 10px 0;
}

.bottm {
    text-align: center;
    font-size: 12px;
    margin: 20px;
    color: #cccccc
}

.bottab {
    text-align: center;
}

.bottab span {
    font-size: 24px
}

.bottab p {
    margin: 5px 0
}

.toword {
    font-size: 14px;
    color: #999;
    text-align: center;
}

.indeximg {
    margin-top: 10px;
    width: 100%;
}

.indeximg img {
    width: 100%;
}
</style>